/*
编写Doctor类{name，age，job，gender，sal}相应的getter()和setter()方法，5个参数构造器
重写父类的equals()方法：public boolean equals(Object obj),并判断测试类中创建的两个对象是否相等。
相等就是判断属性是否相同
 */
//现在这个阶段，我尝试浏览了一下equals方法的jdk源码，这是根据源码来进行重写的
public class Doctor {
    private String name;
    private int age;
    private String job;
    private String gender;
    private double sal;
    public Doctor(String name, int age, String job, String gender, double sal) {
        this.name = name;
        this.age = age;
        this.job = job;
        this.gender = gender;
        this.sal = sal;
    }
    public boolean equals(Object obj) {
        if(this == obj) {
            return true;
        }
        if(obj instanceof Doctor) {
            //向下转型，获取Doctor中的属性
            Doctor doctor = (Doctor) obj;
            return this.name.equals(doctor.name) && this.age == doctor.age && this.job.equals(doctor.job) && this.gender.equals(doctor.gender) && (this.sal ==doctor.sal);
        }
        return false;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSal() {
        return sal;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }
}
